<?php
    header('Access-Control-Allow-Origin: *');
    header('Content-Type:text/html;charset=utf-8');
    $con = mysqli_connect("localhost","root","root","mydb");
    $status = $_GET['status'];
    $uId = $_GET['uid'];
    $uName = $_GET['uname'];
    $uSex = $_GET['usex'];
    if($status == 'student'){
        $uClass = $_GET['uclass'];
        $sql = "UPDATE stu_info SET stu_name = '$uName', stu_sex = '$uSex', class_id = '$uClass' where stu_id = '$uId';";
        $res = mysqli_query($con,$sql);
    }else if($status == 'teacher'){
        $uEmail = $_GET['uemail'];
        $sql = "UPDATE tch_info SET t_name = '$uName', t_sex = '$uSex', t_email = '$uEmail' where t_id = '$uId';";
        $res = mysqli_query($con,$sql);
    }
    if(mysqli_affected_rows($con) > 0){
        echo 'ok';
    }else{
        echo 'fail';
    }
    mysqli_close($con);
?>